package com.example.androidtest.demo;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import com.example.androidtest.R;

public class MainActivity extends AppCompatActivity {
    Button login;
    EditText ed_user;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_demo1);
        inti();
    }

    private void inti() {
        login = findViewById(R.id.login);
        ed_user=findViewById(R.id.ed_user);
        login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this, Main2Activity.class);
                intent.putExtra("username", ed_user.getText().toString());
                startActivity(intent);
            }
        });
    }
}
